using System.Data.SqlClient;
using CoreLibrary.Sql;

namespace CoreLibrary.Messaging.Sql {

    public class CountTotalMessage : ISqlScalar<int> {

        private readonly string _tableName;

        public CountTotalMessage(string tableName) {
            _tableName = tableName;
        }

        public string GetSQL() {
            return string.Format(@"
                select count(*)
                from {0}
            ", _tableName);
        }

        public void SetParameters(SqlCommand command) {
        }

        public int GetResult(SqlConnection conn, object result) {
            return (int) result;
        }

    }
}